package chapter10;

/**
 * @author lzy
 * @version v1.0
 * Create DateTime: 2019/3/9 11:32
 */
public class Parcel5 {
    public static void main(String[] args) {
        Parcel5 parcel5 = new Parcel5();
        Destination destination = parcel5.destination("Tasmania");
        System.out.println(destination.readLabel());
    }

    public Destination destination(String s) {
        class PDestination implements Destination {

            private String label;

            public PDestination(String label) {
                this.label = label;
            }

            @Override
            public String readLabel() {
                return label;
            }
        }

        return new PDestination(s);
    }
}
